package com.banciyuan.bcywebview.utils.string;

import android.content.Context;
import android.text.TextPaint;
import android.text.style.ClickableSpan;
import android.view.View;

import com.banciyuan.bcywebview.R;
import com.banciyuan.bcywebview.biz.pc.zone.smooth.SmoothPersonActivity;
import com.banciyuan.bcywebview.utils.intent.gotoUtil;

/**
 * Created by squall on 2015/11/9.
 */
public class NoLineClickSpan extends ClickableSpan {

    private String uid;

    private Context context;

    private int color;

    public NoLineClickSpan(String uid, Context context) {
        this(uid, context, R.color.timeline_green);
    }

    public NoLineClickSpan(String uid, Context context, int color) {
        this.uid = uid;
        this.context = context;
        this.color = color;
    }

    @Override
    public void updateDrawState(TextPaint ds) {
        ds.setColor(context.getResources().getColor(color));
        ds.setUnderlineText(false);
    }

    @Override
    public void onClick(View widget) {
        gotoUtil.gotoAct(context, SmoothPersonActivity.class, uid);
    }
}
